export const publicFun ={
    data:{
        operator:"="
    },
    methods:{
        toIndex(){
            this.$router.push({path: '/shopIndex'})
        },
        resgister() {
            this.$router.push({path: '/ysregister'})
        },
        forgetPwd() {
            this.$router.push({path: '/forgetPassword'})
        },
        toLogin(){
            this.$router.push({path:'/ysLogin'})
        },
        setCookieValue(key,value){
            document.cookie = key + this.operator+value;
        },
        getCookieValue(keyStr){
            var value = null;
            var s = window.document.cookie;
            var arr = s.split("; ");
            for(var i = 0;i<arr.length;i++){
                var str = arr[i];
                var k = str.split(this.operator)[0];
                var v = str.split(this.operator)[1];
                if(k==keyStr)
                {
                    value=v;
                    break;
                }
            }
            return value;
        },
        delCookie(key){
            this.setCookieValue(key,null)
        },
        toSearch(){
            this.$router.push({path:'/search'})
        },
        toShopCart(){
            this.$router.push({path:'/shopCart'})
        },
        toPayIndex(){
            this.$router.push({path:'/payForShop'})
        },
        toIntroductionShop(productId,productBusinessName){
            this.$router.push({path:'/introductionShop',query:{productId:productId,productBusinessName:productBusinessName}})
        },
        toOnwerIndex()
        {
            this.$router.push({path:'/OnwerIndex'})
        },
        toPayTheOrder(){
            this.$router.push({path:'/payForOrder'})
        },
        toCollectionShop(){
            this.$router.push({path:'/collectionShop'})
        }
    }
}